package com.dubbo.consumer.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dubbo.api.service.CostService;
import com.dubbo.consumer.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * dubbo rpc 通过注解的方式
 */
@Service
@Slf4j
public class ProductServiceImpl implements ProductService {

    /**
     * 使用dubbo的注解 com.alibaba.dubbo.config.annotation.Reference。进行远程调用service
     */
    @Reference
    private CostService costService;

    @Override
    public List<String> findList() {
        List<String> list = costService.findList();
        log.info("consumer 消费数据 ，{}",list);
        return list;
    }
}

